package thread;

/**
 * 现场的地一种创建方式
 * 创建类继承 Thread 重写 run 方法
 */
public class ThreadDemo1 {
    public static void main(String[] args) {
        //多线程 单线程
        Thread t1=new MyThread1();
        Thread t2=new MyThread2();
        t1.start();
        t2.start();
    }
}

class MyThread1 extends Thread{
    public void run(){
        for (int i = 0; i < 1000; i++){
            System.out.println("线程1:" + i);
        }
    }
}

class MyThread2 extends Thread{
    public void run(){
        for (int i = 0; i < 1000; i++){
            System.out.println("线程2:" + i);
        }
    }
}



